﻿using GvS.Controls;
using TstBox = GvS.Controls.HtmlTextbox;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Windows.Forms;
using System.Drawing;

namespace GvS.HtmlTextbox.UnitTests
{
    
    
    /// <summary>
    ///This is a test class for HtmlTextboxTest and is intended
    ///to contain all HtmlTextboxTest Unit Tests
    ///</summary>
    [TestClass()]
    public class HtmlTextboxTest {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        private Form TestForm;
        private TstBox TestBox;

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        [TestInitialize()]
        public void MyTestInitialize()
        {
            this.TestForm = new Form();
            this.TestBox = new TstBox();
            this.TestForm.Controls.Add(TestBox);
        }
        //
        //Use TestCleanup to run code after each test has run
        [TestCleanup()]
        public void MyTestCleanup()
        {
            if (this.TestForm != null) {
                this.TestForm.Dispose();
                this.TestForm = null;
            }
            if (this.TestBox != null) {
                this.TestBox.Dispose();
                this.TestBox = null;
            }
        }
        
        #endregion


        /// <summary>
        ///A test for ToolbarStyle
        ///</summary>
        [TestMethod()]
        public void ToolbarStyleTest() {
            GvS.Controls.HtmlTextbox target = TestBox; 
            ToolbarStyles expected = ToolbarStyles.AlwaysInternal; 
            ToolbarStyles actual;
            target.ToolbarStyle = expected;
            actual = target.ToolbarStyle;
            Assert.AreEqual(expected, actual);

            expected = ToolbarStyles.External;
            target.ToolbarStyle = expected;
            actual = target.ToolbarStyle;
            Assert.AreEqual(expected, actual);

            expected = ToolbarStyles.Hide;
            target.ToolbarStyle = expected;
            actual = target.ToolbarStyle;
            Assert.AreEqual(expected, actual);

            expected = ToolbarStyles.Internal;
            target.ToolbarStyle = expected;
            actual = target.ToolbarStyle;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Text
        ///</summary>
        [TestMethod()]
        public void TextTest() {
            GvS.Controls.HtmlTextbox target = TestBox;
            string expected = "Sinple text";
            string actual;
            target.Text = expected;
            actual = target.Text;
            Assert.AreEqual(expected, actual, "Simple text");

            expected = "<h1>Text with</h1><p>layout</p>";
            target.Text = expected;
            actual = target.Text;
            Assert.AreEqual(expected, actual, "Simple layout");

            string input = "<h1>Text with</h1><script>illegal layout</script>";
            expected = "<h1>Text with</h1>illegal layout</script>";
            target.Text = input;
            actual = target.Text;
            Assert.AreEqual(expected, actual, "Illegal input: returned {0}", actual);

        }

        /// <summary>
        ///A test for ShowHtmlSource
        ///</summary>
        [TestMethod()]
        public void ShowHtmlSourceTest() {
            GvS.Controls.HtmlTextbox target = TestBox; 
            bool expected = false;
            bool actual;
            target.ShowHtmlSource = expected;
            actual = target.ShowHtmlSource;
            Assert.AreEqual(expected, actual);

            expected = true;
            target.ShowHtmlSource = expected;
            actual = target.ShowHtmlSource;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for PlainText
        ///</summary>
        [TestMethod()]
        public void PlainTextTest() {
            GvS.Controls.HtmlTextbox target = TestBox; 
            string actual;
            string input;
            string expected;

            input = "Simple plain text";
            expected = "Simple plain text";
            target.Text = input;
            actual = target.PlainText;
            Assert.AreEqual(expected, actual);

            input = "<h1>Text</h1><p>with <strong>simple</strong> layout</p>";
            expected = @"Text
with simple layout";
            target.Text = input;
            actual = target.PlainText;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for IsSourceFocused
        ///</summary>
        [TestMethod()]
        public void IsSourceFocusedTest() {
            GvS.Controls.HtmlTextbox target = new GvS.Controls.HtmlTextbox(); // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.IsSourceFocused;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for IsBrowserFocused
        ///</summary>
        [TestMethod()]
        public void IsBrowserFocusedTest() {
            GvS.Controls.HtmlTextbox target = new GvS.Controls.HtmlTextbox(); // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.IsBrowserFocused;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for IllegalPatterns
        ///</summary>
        [TestMethod()]
        public void IllegalPatternsTest() {
            GvS.Controls.HtmlTextbox target = new GvS.Controls.HtmlTextbox(); // TODO: Initialize to an appropriate value
            string[] expected = null; // TODO: Initialize to an appropriate value
            string[] actual;
            target.IllegalPatterns = expected;
            actual = target.IllegalPatterns;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Fonts
        ///</summary>
        [TestMethod()]
        public void FontsTest() {
            GvS.Controls.HtmlTextbox target = new GvS.Controls.HtmlTextbox(); // TODO: Initialize to an appropriate value
            string[] expected = null; // TODO: Initialize to an appropriate value
            string[] actual;
            target.Fonts = expected;
            actual = target.Fonts;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ContainsFocusExtra
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GvS.Controls.HtmlTextbox.dll")]
        public void ContainsFocusExtraTest() {
            HtmlTextbox_Accessor target = new HtmlTextbox_Accessor(); // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.ContainsFocusExtra;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for BrowserText
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GvS.Controls.HtmlTextbox.dll")]
        public void BrowserTextTest() {
            HtmlTextbox_Accessor target = new HtmlTextbox_Accessor(); // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            target.BrowserText = expected;
            actual = target.BrowserText;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for BorderColorNonFocused
        ///</summary>
        [TestMethod()]
        public void BorderColorNonFocusedTest() {
            GvS.Controls.HtmlTextbox target = TestBox;
            Color expected = Color.Green;
            Color actual;
            target.BorderColorNonFocused = expected;
            actual = target.BorderColorNonFocused;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for BorderColorFocused
        ///</summary>
        [TestMethod()]
        public void BorderColorFocusedTest() {
            GvS.Controls.HtmlTextbox target = TestBox;
            Color expected = Color.Red; 
            Color actual;
            target.BorderColorFocused = expected;
            actual = target.BorderColorFocused;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for ShowHideToolbar
        ///</summary>
        [TestMethod()]
        public void ShowHideToolbarTest() {
            GvS.Controls.HtmlTextbox target = TestBox;
            target.ShowHideToolbar();
        }

        /// <summary>
        ///A test for ShowHideSourcePanel
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GvS.Controls.HtmlTextbox.dll")]
        public void ShowHideSourcePanelTest() {
            HtmlTextbox_Accessor target = new HtmlTextbox_Accessor(); 
            target.ShowHideSourcePanel();
        }

        /// <summary>
        ///A test for ShowHideAll
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GvS.Controls.HtmlTextbox.dll")]
        public void ShowHideAllTest() {
            HtmlTextbox_Accessor target = new HtmlTextbox_Accessor();
            target.ShowHideAll();
        }

        /// <summary>
        ///A test for FilterHtml
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GvS.Controls.HtmlTextbox.dll")]
        public void FilterHtmlTest() {
            HtmlTextbox_Accessor target = new HtmlTextbox_Accessor(); // TODO: Initialize to an appropriate value
            string original = string.Empty; // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            actual = target.FilterHtml(original);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Dispose
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GvS.Controls.HtmlTextbox.dll")]
        public void DisposeTest() {
            HtmlTextbox_Accessor target = new HtmlTextbox_Accessor(); 
            bool disposing = false;
            target.Dispose(disposing);
        }

        /// <summary>
        ///A test for HtmlTextbox Constructor
        ///</summary>
        [TestMethod()]
        public void HtmlTextboxConstructorTest() {
            GvS.Controls.HtmlTextbox target = new GvS.Controls.HtmlTextbox();
        }
   }
}
